<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Date / Time Picker</title>

<script type="text/javascript" language="javascript"
	src="/nems/admin/time/prototype-1.js"></script>
<script type="text/javascript" language="javascript"
	src="/nems/admin/time/prototype-base-extensions.js"></script>
<script type="text/javascript" language="javascript"
	src="/nems/admin/time/prototype-date-extensions.js"></script>
<script type="text/javascript" language="javascript"
	src="/nems/admin/time/behaviour.js"></script>
<script type="text/javascript" language="javascript"
	src="/nems/admin/time/datepicker.js"></script>
<link rel="stylesheet" href="/nems/admin/time/datepicker.css" />
<script type="text/javascript" language="javascript"
	src="/nems/admin/time/behaviors.js"></script>

<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript">
	function courseCheck() {

		var courseName = document.getElementById("courseName").value;
		var lecturerName = document.getElementById("lecturerName").value;
		var startDate = document.getElementById("startDate").value.split("-");
		var endDate = document.getElementById("endDate").value.split("-");
		var startTime = document.getElementById("startTime").value.split(":");
		var endTime = document.getElementById("endTime").value.split(":");

		if (courseName == '') {
			alert("강의명을 입력하세요");
			return false;
		}
		if (lecturerName == '') {
			alert("강사명을 입력하세요");
			return false;
		}
		if (startDate == '') {
			alert("시작일을 입력하세요");
			return false;
		}
		if (endDate == '') {
			alert("종료일을 입력하세요");
			return false;
		}
		if (startTime == '') {
			alert("시작 시간을 입력하세요");
			return false;
		}
		if (endTime == '') {
			alert("종료 시간을 입력하세요");
			return false;
		}

		var dStartDate = new Date(startDate[0], startDate[1], startDate[2])
				.valueOf();
		var dEndDate = new Date(endDate[0], endDate[1], endDate[2]).valueOf();
		var dStratTime = new Date(startTime[0], startTime[1]).valueOf();
		var dEndTime = new Date(endTime[0], endTime[1]).valueOf();

		if (dStartDate > dEndDate) {
			alert("시작일이 종료일 보다 늦을수 없습니다.");
			return false;
		}
		if (dStratTime > dEndTime) {
			alert("시작시간이 종료시간 보다 늦을수 없습니다.");
			return false;
		}

		return true;
	}
</script>

<style>
<!--
@import url("css/style.css");
-->
</style>


<style type="text/css">
#info {
	font-family: 맑은 고딕, dotum, sans-serif, bold;
	font-size: 13px
}
</style>

</head>
<body>


	<div id="info">
		<br>
		<table align="left" style="margin-left: 20px">
			<tr>

				<td width="60" height="50"><img
					src="/nems/admin/images/course.png" width="40" /></td>

				<td>
					<h4
						style="font-weight: bold; color: #005700; text-align: left; font-size: 20px;">클래스
						수정</h4>
				</td>
			</tr>
		</table>
		<br> <br> <br><br><hr>
		<form
			action="courseUpdate.course?courseId=${requestScope.course.courseId}"
			id="fn" name="fn" method="post">


		<center>
			<table style="width:700" border="0">

				<tr align="left">

					<td width="300" height="35">클래스 명</td>
					<td width="300"><input type="text" id="courseName"
						name="courseName" class="form-control" placeholder="클래스명"
						style="height: 20px; width: 205px"
						value='${requestScope.course.courseName}' /></td>
				</tr>

				<tr align="left">
					<td width="300" height="35">강사명</td>
					<td width="300"><input type="text" id="lecturerName"
						name="lecturerName" class="form-control" placeholder="강사명"
						style="height: 20px; width: 205px"
						value='${requestScope.course.lecturer}' /></td>

				</tr>

				<tr align="left">
					<td width="300" height="35">시작일</td>
					<td width="300">
						<div>
							<input class="datepicker" placeholder="날짜 입력" name="startDate"
								id="startDate" style="height: 20px; width: 185px" readonly
								value='${requestScope.course.startDate}' />

						</div>
					</td>
					<td></td>


				</tr>

				<tr align="left">
					<td width="300" height="35">종료일</td>
					<td width="300">
						<div>
							<input class="datepicker" name="endDate" id="endDate"
								placeholder="날짜 입력" style="height: 20px; width: 185px" readonly
								value='${requestScope.course.endDate}' />

						</div>
					</td>
					<td></td>

				</tr>

				<tr align="left">
					<td width="300" height="35">시작시간</td>
					<td width="300">
						<div>
							<input class="timepicker" id="startTime" name="startTime"
								placeholder="시작시간 입력" value='${requestScope.course.startTime}' />
						</div>
					</td>


					<td></td>

				</tr>

				<tr align="left">
					<td width="300" height="35">종료시간</td>
					<td width="300">
						<div>
							<input class="timepicker" id="endTime" name="endTime"
								placeholder="종료시간 입력" value='${requestScope.course.endTime}' />
						</div>
					</td>
					<td></td>
				</tr>
				<tr align="left">
					<td width="300" height="35">결석 1회 지각 몇번?</td>
					<td width="300"><select id="lateGrade" name="lateGrade" style="width: 50px">
							<option value="1">1</option>
							<option value="2">2</option>
							<option value="3">3</option>
							<option value="4">4</option>
							<option value="5">5</option>
					</select></td>
					<td></td>
				</tr>
				<tr align="left">
					<td width="300" height="35">결석 1회 조퇴 몇번?</td>
					<td width="300"><select id="ealryGrade" name="ealryGrade" style="width: 50px">
							<option value="1">1</option>
							<option value="2">2</option>
							<option value="3">3</option>
							<option value="4">4</option>
							<option value="5">5</option>
					</select></td>
					<td></td>
				</tr>






			</table>
			</center>
	<hr>
	<br>
	<br>
	<center>

		<button class="positive" style="width: 70px" type="submit"
			onclick="return courseCheck()">
			<img src="cust/img/shopping_cart_accept.png"
				style="width: 20px; height: 10px" />수정
		</button>

		<button class="negative" style="width: 70px" type="button"
			onclick="javascript:location.replace('courseSearch.course')">
			<img src="cust/img/delete.png" style="width: 20px; height: 10px" />취소
		</button>

	</center>
	</form>
	</div>
</body>
</html>
